home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / tests / gtty / RCS / foo.c,v < prev   
Encoding:
Text File  |  1992-07-17  |  1.1 KB  |  62 lines

  1. head     1.1;
  2. branch   ;
  3. access   ;
  4. symbols  srv030:1.1 srv027:1.1 srv026:1.1 srv024:1.1 srv021:1.1 srv018:1.1 srv014:1.1 srv010:1.1 srv008:1.1 srv007:1.1 srv006:1.1 srv004:1.1;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.1
  10. date     92.03.23.15.13.35;  author kupfer;  state Exp;
  11. branches ;
  12. next     ;
  13.  
  14.  
  15. desc
  16. @Test program for ioctl's on the console.
  17. @
  18.  
  19.  
  20.  
  21. 1.1
  22. log
  23. @Initial revision
  24. @
  25. text
  26. @/* 
  27.  * Short test program to verify that cross-host ioctl's work on the 
  28.  * console. 
  29.  */
  30.  
  31. #include <stdio.h>
  32. #include <sys/file.h>
  33. #include <sgtty.h>
  34.  
  35. main(argc, argv)
  36.     int argc;
  37.     char *argv[];
  38. {
  39.     int dev;            /* device to get attributes for */
  40.     struct sgttyb info;        /* attributes */
  41.  
  42.     if (argc == 1) {
  43.     dev = fileno(stdout);
  44.     } else {
  45.     dev = open(argv[1], O_RDONLY, 0);
  46.     if (dev < 0) {
  47.         perror(argv[1]);
  48.         exit(1);
  49.     }
  50.     }
  51.  
  52.     if (gtty(dev, &info) < 0) {
  53.     perror("can't get device attributes");
  54.     exit(1);
  55.     }
  56.  
  57.     printf("input speed: %d, erase: 0x%x, kill: 0x%x\n",
  58.        info.sg_ispeed, info.sg_erase, info.sg_kill);
  59.     printf("flags: 0%o\n", info.sg_flags);
  60. }
  61. @
  62.